/**
 * 
 */
package com.coder520.sync_learning.demo;

/**
 * @author zhaoyibo
 *	创建线程组
 */
public class ThreadGroupCreator {
	public static void main(String[] args) {
		//获取当前的线程group
		ThreadGroup currentGroup=Thread.currentThread().getThreadGroup();
		
		//定义一个新的group
		ThreadGroup threadGroup=new ThreadGroup("group1");
		
		//程序输出true
		System.out.println(threadGroup.getParent()==currentGroup);
		
		//定义一个group2,指定group的parent为group
		ThreadGroup threadGroup2=new ThreadGroup(threadGroup,"group2");
		
		//程序输出为true
		System.out.println(threadGroup2.getParent()==threadGroup);
		
		
	}
}
